For this to work you'll need to have the travis CLI installed and have already run login (cd to a menpo dir before running login for auto magic)

> sudo gem install travis

In [ ]:
import os
import subprocess
from utils import apply_to_all_projects

working_dir = '~/_change_pypi_usernames'
PYPI_USER = 'not a chance'
PYPI_PASSWORD = 'not a chance'
PYPI_TEST_USER = 'not a chance'
PYPI_TEST_PASSWORD = 'not a chance'

def bump_repo(repo_dir, restart_travis=False):
    os.chdir(repo_dir)
    print(subprocess.check_output(['travis', 'env', 'set', 'PYPI_USER', PYPI_USER]))
    print(subprocess.check_output(['travis', 'env', 'set', 'PYPI_PASSWORD', PYPI_PASSWORD]))
    print(subprocess.check_output(['travis', 'env', 'set', 'PYPI_TEST_USER', PYPI_TEST_USER]))
    print(subprocess.check_output(['travis', 'env', 'set', 'PYPI_TEST_PASSWORD', PYPI_TEST_PASSWORD]))
    if restart_travis:
        print(subprocess.check_output(['travis', 'restart']))

In [ ]:
apply_to_all_projects(working_dir, bump_repo)